# 定义变量
$IMAGE_NAME = "weidian9/tongxun"
$NAME = "tongxun"
$TAG = "latest"
$DOCKERFILE_PATH = "."

# 本地打包并构建 Docker 镜像

$buildResult = docker build -t "${NAME}:${TAG}" $DOCKERFILE_PATH --progress=plain
if ($LASTEXITCODE -ne 0) {
    Write-Output "Docker 镜像构建失败: $buildResult"
    exit 1
}

# 上传 Docker 镜像到私有仓库

$pushResult = docker push "${IMAGE_NAME}:${TAG}"
if ($LASTEXITCODE -ne 0) {
    Write-Output "Docker 镜像推送失败: $pushResult"
    exit 1
}

